package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchSingleWaterQualityIndicatorQualifiedRateStats;
import com.ruoyi.system.service.IDispatchSingleWaterQualityIndicatorQualifiedRateStatsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 单项水质合格率统计Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchSingleWaterQualityIndicatorQualifiedRateStats")
public class DispatchSingleWaterQualityIndicatorQualifiedRateStatsController extends BaseController
{
    @Autowired
    private IDispatchSingleWaterQualityIndicatorQualifiedRateStatsService dispatchSingleWaterQualityIndicatorQualifiedRateStatsService;

    /**
     * 查询单项水质合格率统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSingleWaterQualityIndicatorQualifiedRateStats:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchSingleWaterQualityIndicatorQualifiedRateStats dispatchSingleWaterQualityIndicatorQualifiedRateStats)
    {
        startPage();
        List<DispatchSingleWaterQualityIndicatorQualifiedRateStats> list = dispatchSingleWaterQualityIndicatorQualifiedRateStatsService.selectDispatchSingleWaterQualityIndicatorQualifiedRateStatsList(dispatchSingleWaterQualityIndicatorQualifiedRateStats);
        return getDataTable(list);
    }

    /**
     * 导出单项水质合格率统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSingleWaterQualityIndicatorQualifiedRateStats:export')")
    @Log(title = "单项水质合格率统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchSingleWaterQualityIndicatorQualifiedRateStats dispatchSingleWaterQualityIndicatorQualifiedRateStats)
    {
        List<DispatchSingleWaterQualityIndicatorQualifiedRateStats> list = dispatchSingleWaterQualityIndicatorQualifiedRateStatsService.selectDispatchSingleWaterQualityIndicatorQualifiedRateStatsList(dispatchSingleWaterQualityIndicatorQualifiedRateStats);
        ExcelUtil<DispatchSingleWaterQualityIndicatorQualifiedRateStats> util = new ExcelUtil<DispatchSingleWaterQualityIndicatorQualifiedRateStats>(DispatchSingleWaterQualityIndicatorQualifiedRateStats.class);
        util.exportExcel(response, list, "单项水质合格率统计数据");
    }

    /**
     * 获取单项水质合格率统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSingleWaterQualityIndicatorQualifiedRateStats:query')")
    @GetMapping(value = "/{singleWaterQualityIndicatorQualifiedRateStatsId}")
    public AjaxResult getInfo(@PathVariable("singleWaterQualityIndicatorQualifiedRateStatsId") Long singleWaterQualityIndicatorQualifiedRateStatsId)
    {
        return success(dispatchSingleWaterQualityIndicatorQualifiedRateStatsService.selectDispatchSingleWaterQualityIndicatorQualifiedRateStatsBySingleWaterQualityIndicatorQualifiedRateStatsId(singleWaterQualityIndicatorQualifiedRateStatsId));
    }

    /**
     * 新增单项水质合格率统计
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSingleWaterQualityIndicatorQualifiedRateStats:add')")
    @Log(title = "单项水质合格率统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchSingleWaterQualityIndicatorQualifiedRateStats dispatchSingleWaterQualityIndicatorQualifiedRateStats)
    {
        return toAjax(dispatchSingleWaterQualityIndicatorQualifiedRateStatsService.insertDispatchSingleWaterQualityIndicatorQualifiedRateStats(dispatchSingleWaterQualityIndicatorQualifiedRateStats));
    }

    /**
     * 修改单项水质合格率统计
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSingleWaterQualityIndicatorQualifiedRateStats:edit')")
    @Log(title = "单项水质合格率统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchSingleWaterQualityIndicatorQualifiedRateStats dispatchSingleWaterQualityIndicatorQualifiedRateStats)
    {
        return toAjax(dispatchSingleWaterQualityIndicatorQualifiedRateStatsService.updateDispatchSingleWaterQualityIndicatorQualifiedRateStats(dispatchSingleWaterQualityIndicatorQualifiedRateStats));
    }

    /**
     * 删除单项水质合格率统计
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSingleWaterQualityIndicatorQualifiedRateStats:remove')")
    @Log(title = "单项水质合格率统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{singleWaterQualityIndicatorQualifiedRateStatsIds}")
    public AjaxResult remove(@PathVariable Long[] singleWaterQualityIndicatorQualifiedRateStatsIds)
    {
        return toAjax(dispatchSingleWaterQualityIndicatorQualifiedRateStatsService.deleteDispatchSingleWaterQualityIndicatorQualifiedRateStatsBySingleWaterQualityIndicatorQualifiedRateStatsIds(singleWaterQualityIndicatorQualifiedRateStatsIds));
    }
}
